package com.example.websocket.config;

import com.example.websocket.model.WebsocketProperty;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

@Configuration
public class WebsocketConfig {

    @Value("${websocket.msg.accept-myselft:false}")
    private boolean acceptMyselft;
    @Value("${websocket.msg.accept-room:false}")
    private boolean acceptRoom;


    @Bean
    public WebsocketProperty websocketProperty() {
        WebsocketProperty websocketProperty = new WebsocketProperty();
        websocketProperty.setAcceptMyselft(acceptMyselft);
        websocketProperty.setAcceptRoom(acceptRoom);
        return websocketProperty;
    }

    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

}